function drawMenuItem(canvas) {
    <!--Clear canvas for redraw-->
    canvas.width = canvas.width;
    var context=canvas.getContext("2d");
    context.font="25px Arial";
    var metrics = context.measureText(canvas.getAttribute("data-name"));
    context.canvas.width = metrics.width;
    context.font="25px Arial";
    context.strokeText(canvas.getAttribute("data-name"),0,30);
}

function drawClickedMenuItem(canvas) {
    <!--Clear canvas for redraw-->
    canvas.width = canvas.width;
    var ctx=canvas.getContext("2d");
    ctx.font="25px Arial";
    ctx.fillText(canvas.getAttribute("data-name"),0,30);
}

function allowDrop(ev)
{
    ev.preventDefault();
}

function drag(ev)
{
    ev.dataTransfer.setData("canvasToDrop", ev.target.id);
}

function drop(ev)
{
    var divTobeDropped;
    var canvasToDrop;
    var cameFrom;
    var canvasToSendBack = null;

    if(document.getElementById(ev.target.id).tagName=="CANVAS") {
        divTobeDropped = document.getElementById(ev.target.id).parentNode.id;
        canvasToSendBack = ev.target.id;
    }
    else {
        divTobeDropped = ev.target.id;
        //This is for empty div that doesnt contain an image
        if(document.getElementById(divTobeDropped).getElementsByTagName("canvas").length != 0) {
            canvasToSendBack = document.getElementById(divTobeDropped).getElementsByTagName("canvas")[0].id;
        }
    }

    ev.preventDefault();
    canvasToDrop = ev.dataTransfer.getData("canvasToDrop");
    cameFrom = document.getElementById(canvasToDrop).parentNode.id;
    document.getElementById(divTobeDropped).appendChild(document.getElementById(canvasToDrop));

    if(canvasToSendBack != null) {
        document.getElementById(cameFrom).appendChild(document.getElementById(canvasToSendBack));

    }
    else {
        document.getElementById(divTobeDropped).width = "550px";
        document.getElementById(divTobeDropped).height = "550px";
    }

    //drawMenuItem(canvasToDrop);
    //drawMenuItem(canvasToSendBack);

}